
// 匹配未知的Object对象
export interface AnyObject {
    [key: string]: any;
    [key: number]: any;
    [key: symbol]: any;
}

// Select 等组件的option属性
export interface OptionProps {
    label: string,
    value: string | number,
    disabled?: boolean,
    children?: OptionProps[],
}

// 为组件添加附加属性
export function attachPropertiesToComponent<C, P extends Record<string, any>>(Component: C, properties: P): C & P {
    const ret = Component as any;
    for(const key in properties) {
        if(properties.hasOwnProperty(key)) {
            ret[key] = properties[key];
        }
    }
    return ret;
}